<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>管理界面</title>
</head>
<body>
    <label for="version">版本号：</label>

    <input id="version" style="width: 50%;height: 2rem">
    <label>旧版本号：</label>
    <input disabled style="width: 10%;height: 2rem" th:value="${oldVersion}">
    <br>
    <label for="info">介绍:</label>
    <textarea id="info" style="width: 50%;height: 25rem;margin-top: 3rem"></textarea>
    <textarea disabled style="width: 30%;height: 25rem;margin-top: 3rem" th:text="${oldInfo}">aaaa</textarea>
    <br>
    <button style="height: 2rem;width: 6rem;margin-left: 20%" onclick="upgradeF()">提交新版本</button>
    <br>
    <label for="has_info" style="margin-top: 2rem">是否有公告：0/1</label>
    <input id="has_info" style="width: 10%;height: 2rem;margin-top: 2rem" type="number">
    <label  style="margin-top: 2rem">当前：0/1</label>
    <input disabled style="width: 10%;height: 2rem;margin-top: 2rem" type="text" th:value="${oldHas}">
    <br>
    <label for="info_info">公告内容:</label>
    <textarea id="info_info" style="width: 50%;height: 25rem;margin-top: 3rem"></textarea>
    <textarea disabled style="width: 30%;height: 25rem;margin-top: 3rem" th:text="${oldGong}"></textarea>
    <br>
    <button style="height: 2rem;width: 5rem;margin-left: 20%" onclick="infoinfoF()">提交公告</button>
    <br>

    <label for="info_first" style="margin-top: 2rem">给新用户的话:</label>
    <textarea id="info_first" style="width: 50%;height: 25rem;margin-top: 3rem"></textarea>
    <textarea disabled style="width: 30%;height: 25rem;margin-top: 3rem" th:text="${oldNew}"></textarea>
    <br>
    <button style="height: 2rem;width: 5rem;margin-left: 20%" onclick="firstF()">提交</button>
    <br>
</body>
<script src="js/jquery.js"></script>
<script>



    function upgradeF() {
        let version = document.getElementById("version");
        let info = document.getElementById("info");

        $.ajax({
            data:{version:version.value,info:info.value},
            url:"/x/v/up",
            success(r){
                console.log(r)
                alert(r);
            }
        })
    }
    function infoinfoF() {
        let hasInfo = document.getElementById("has_info");
        var has;
        if(hasInfo.value == 0){
            has = "no";
        }else {
            has = "hasInfo";
        }
        let infoinfo = document.getElementById("info_info");
        $.ajax({
            data:{has_info:has,info_info:infoinfo.value},
            url:"/x/v/hasinfo",
            success(r){
                console.log(r)
                alert(r);
            }
        })
    }


    function firstF() {
        let infofirst = document.getElementById("info_first");
        $.ajax({
            data:{first_info:infofirst.value},
            url:"/x/v/firstinfo",
            success(r){
                console.log(r)
                alert(r);
            }
        })
    }

</script>

</html>